package edu.gdit.health.dao;

import edu.gdit.health.model.SysReport;
import edu.gdit.health.model.SysReportCount;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysReportCountDao {
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into sys_report_count(name,value,type, createTime,report_date) " +
            "values(#{name}, #{value}, #{type}, #{createTime}, #{reportDate})")
    int save(SysReportCount reportCount);

    @Select("select * from sys_report_count t where `type`=#{type} and DATE_FORMAT(t.createTime, '%Y-%m-%d') = DATE_FORMAT(now() , '%Y-%m-%d')   ")
    List<SysReportCount> query(@Param("type")String type);
    @Delete(" delete from sys_report_count where report_date = #{reportDate} and `type`=#{type} and `name` = #{name} ")
    void delete(SysReportCount item);
}
